package com.qzct.service.impl;

import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.qzct.controller.AttractionsController;
import com.qzct.entity.Attractions;
import com.qzct.entity.vo.AttractionVo;
import com.qzct.mapper.AttractionImgsMapper;
import com.qzct.mapper.AttractionsMapper;
import com.qzct.service.AttractionImgsService;
import com.qzct.service.AttractionsService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.ArrayList;

/**
 *  服务层实现。
 *
 * @author 闽闽
 * @since 2025-01-11
 */
@Service
public class AttractionsServiceImpl extends ServiceImpl<AttractionsMapper, Attractions> implements AttractionsService {

    @Autowired
    AttractionsMapper attractionsMapper;


    @Override
    public int insert(Attractions attractions) {
        return attractionsMapper.insert(attractions);
    }

    @Override
    public int getMaxId() {
        return attractionsMapper.getMaxId();
    }

    @Override
    public ArrayList<Integer> gethot0() {
        ArrayList<Integer> ids = attractionsMapper.gethot0();
        ids.add(0,attractionsMapper.getkys());
        ids.add(0,attractionsMapper.getxpc());

        return ids;
    }

    @Override
    public ArrayList<Integer> gethot1() {
        ArrayList<Integer> ids = attractionsMapper.gethot1();
        ids.add(0,attractionsMapper.getqqys());
        ids.add(0,attractionsMapper.getlfs());
//        for (int i = 0; i < attractions.size(); i++) {
//            AttractionVo attractionVo = new AttractionVo();
//            attractionVo.setAttractions(attractions.get(i));
//            attractionVo.setList(attractionImgsService.getByCid(attractions.get(i).getAttractionId()));
//            list.add(attractionVo);
//        }
        return ids;
    }

    @Override
    public ArrayList<Integer> getHot() {
        ArrayList<Integer> ids = attractionsMapper.getHot();
//        for (int i = 0; i < attractions.size(); i++) {
//            AttractionVo attractionVo = new AttractionVo();
//            attractionVo.setAttractions(attractions.get(i));
//            attractionVo.setList(attractionImgsService.getByCid(attractions.get(i).getAttractionId()));
//            list.add(attractionVo);
//        }
        return ids;
    }

    @Override
    public void addlike(Serializable id) {
        attractionsMapper.addlike(id);
    }

    @Override
    public ArrayList<Attractions> getList() {
        return attractionsMapper.getList();
    }
}
